package baidu.com.matedemo;

import com.baidu.duer.smartmate.out.DuerDevice;

import java.util.ArrayList;
import java.util.List;

import baidu.com.matedemo.pair.OauthType;

/**
 * Created by niufei01 on 2017/9/11.
 */

public class DemoApp {

    private OauthType oauthType;

    private static DemoApp mateApp;

    public static DemoApp getInstance() {

        if (mateApp == null) {

            synchronized (DemoApp.class) {

                if (mateApp == null) {

                    mateApp = new DemoApp();
                }
            }
        }
        return mateApp;
    }

    public OauthType getOauthType() {
        return oauthType;
    }

    /**
     * 设置当前的授权类型
     * @param oauthType
     */
    public void setOauthType(OauthType oauthType) {
        this.oauthType = oauthType;
    }

    public List<DuerDevice> duerDeviceList = new ArrayList<>();
    private DuerDevice currentDevice;

    public List<DuerDevice> getDuerDeviceList() {
        return duerDeviceList;
    }

    public void addDuerDevice(DuerDevice duerDevice) {
        if (!duerDeviceList.contains(duerDevice)) {
            this.duerDeviceList.add(duerDevice);
        }
    }

    public DuerDevice getCurreDuerDevice() {
        return currentDevice;
    }

    public void setCurrentDevice(DuerDevice device) {
        currentDevice = device;
    }
}
